home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_11_08
/
hellquis
/
teststr.cpp
< prev
next >
Wrap
C/C++ Source or Header
|
1993-01-22
|
978b
|
44 lines
//teststr.cpp -- simple test routine for GetPrivateProfileString
#include "profiles.h"
#include <string.h>
#include <iostream.h>
void main()
{
char app[81];
char key[81];
char out[600];
char *s ;
int no ;
//-- part one , test getting all keys for an application
cout << "This test uses file test.ini\n";
cout << "Application -> all keys :" ;
cin.get(app,sizeof(app));
cin.ignore();
no = GetPrivateProfileString
(app,NULL,NULL,out,600,"test.ini");
cout << "no : " << no << "\n";
s = out ;
while (*s)
{
cout << " str : " << s << "\n" ;
s +=strlen(s)+1;
}
//-- part two, repeatedly test getting a specific key
for (;;)
{
cout << "Application :";
cin.get(app,sizeof(app));
cin.ignore();
cout << "Key :";
cin.get(key,sizeof(key)) ;
cin.ignore();
no = GetPrivateProfileString
(app,key,"Default",out,81,"test.ini");
cout << "no : " << no << " str : " << out << "\n" ;
}
}
//-- end of teststr.cpp